<template>
  <div>
    <el-card>
      <el-form :inline="true" ref="form" label-width="90px" size="mini" >
        <el-form-item label="快递员姓名" >
          <el-input  placeholder="请输入快递员姓名" v-model="user.name"></el-input>
        </el-form-item>
        <el-form-item label="快递员电话" >
          <el-input  placeholder="请输入快递员电话" suffix-icon=“xxxx” v-model="user.mobile"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button @click="selectPage()">查询</el-button>
          <el-button @click="qk()">重置</el-button>
        </el-form-item>
      </el-form>
    </el-card>
    <el-divider></el-divider>
    <el-card>
      <!-- 表 -->
      <el-table :data="tableData" v-loading="loading" style="width: 100%" >
        <el-table-column prop="id" label="编号" ></el-table-column>
        <el-table-column prop="name" label="姓名" ></el-table-column>
        <el-table-column prop="mobile" label="手机号" ></el-table-column>
        <el-table-column prop="orgName" label="所属机构"></el-table-column>
        <el-table-column prop="account" label="快递员账号"></el-table-column>
        <el-table-column fixed="right" label="操作">
          <template slot-scope="scope">
            <el-button type="text" @click="AreaXQ(scope.row.id)">作业范围分配</el-button>
            <el-button type="text" @click="xq(scope.row)">快递员详情</el-button>
          </template>
        </el-table-column>
      </el-table>
      <!-- 分页 -->
      <div style="text-align: center" >
        <br>
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="page"
          :page-sizes="[ 5, 10, 15, 20]"
          :page-size="size"
          layout="total, sizes, prev, pager, next, jumper"
          :total="sizes" >
        </el-pagination>
      </div>
    </el-card>
  </div>
</template>
<script>
  import OrderCargoList from '../../../../src/api/logisticsmanagement/branchManagement/operationalAreaManagement'
  export default {
    name: 'operationalAreaManagement',
    data() {
      return {
        loading: false,
        page: 1,
        size: 5,
        sizes: 0,
        tableData: [],
        user:{
          name: '',
          mobile: ''
        },
        userQK:{
          name: '',
          mobile: ''
        }
      }
    },
    methods: {
      selectPage(){
        this.loading = true
        OrderCargoList.getPage(this.page, this.size, this.user).then(({data})=>{
          this.page = data.data.pageNum
          this.size = data.data.pageSize
          this.sizes = data.data.total
          this.tableData = data.data.list
          this.loading = false
        })
      },
      qk () {
        this.user = this.userQK
      },
      // 显示数
      handleSizeChange (v) {
        this.size = v
        this.selectPage()
      },
      // 上下页
      handleCurrentChange (v) {
        this.page = v
        this.selectPage()
      },
      xq(obj){
        this.$router.push({path:'/operationalAreaManagementXQ',query:{obj:obj}})
      },
      AreaXQ(id){
        this.$router.push({path:'/operationalAreaUpdate',query:{id:id}})
      }
    },
    created() {
      this.selectPage()
    }
  }
</script>
<style>

</style>
